package com.mate.cloud.auth.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mate.cloud.auth.entity.Menu;
import com.mate.cloud.auth.mapper.MenuMapper;
import com.mate.cloud.auth.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<Menu> getByIds(int... ids) {
        if(Objects.isNull(ids) || ids.length == 0) {
            return new ArrayList<>();
        }

        return menuMapper.selectByIds(Collections.singleton(ids));
    }
}
